package net.mimai.vultrue.bus.enums;

import net.mimai.vultrue.framework.utils.JudgeUtils;


/**
 *  交易类型
 */
public enum TxType {
    INIT(10,"期初"),
    SALE(11,"销售"),
    PURCHASE(20,"采购"),
    STORE_TAKE(21,"盘点"),
    STORE_ALLOT(22,"调拨"),
    STORE_OTHER(23,"其它"),
    MAINTAIN(30,"维修养护"),

    //回收
    RECOVERY(50,"回收"),
    //寄卖
    CONSIGN_SALE(51,"寄卖"),

    PAWN(52,"典当"),

    EASY_LOAN(53,"奢易贷"),

    BUYBACK(54,"回购"),

    CHECK(60,"银行对账"),

    SIGN_IN(70, "签到"),

    ;
    int key;
    String desc;

    TxType(int key, String desc) {
        this.key = key;
        this.desc = desc;
    }

    public int getKey() {
        return key;
    }

    public void setKey(int key) {
        this.key = key;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static Boolean isMember(int key){
        TxType[] vs= TxType.values();
        for(TxType h:vs){
            if(JudgeUtils.equals(key,h.getKey())){
                return true;
            }
        }
        return false;
    }

    public static TxType getByKey(int key){
        TxType[] vs= TxType.values();
        for(TxType h:vs){
            if(JudgeUtils.equals(key,h.getKey())){
                return h;
            }
        }
        return null;
    }
}
